<template></template><template>
  <div class="gdxx_box">
    <div class="gdxx_title">人员信息</div>
    <div class="table_gdxx">
      <el-table :data="tableData" stripe fit>
        <el-table-column prop="realname" label="姓名"> </el-table-column>
        <el-table-column prop="code" label="证件号码" fit> </el-table-column>
        <el-table-column prop="cert_code" label="资格证号" fit>
        </el-table-column>
        <el-table-column prop="mobile" label="电话"></el-table-column>
        <el-table-column label="操作" width="160">
          <template slot-scope="scope">
            <el-button
              v-if="
                infostate == 0 ||
                infostate == 2 ||
                infostate == 5 ||
                infostate == 3
              "
              @click="next('/hyryxxxq_1', scope.row)"
              type="text"
              >编辑信息</el-button
            >
            <el-button
              @click="next('/hyryxxxq_1', scope.row)"
              type="text"
              v-else
              >查看信息</el-button
            >
            <el-button
              @click="del(scope.row)"
              type="text"
              v-if="
                infostate == 0 ||
                infostate == 2 ||
                infostate == 5 ||
                infostate == 3
              "
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="button_box_jb">
      <div
        class="zc"
        @click="next('/hyryxxxq_1')"
        v-if="
          infostate == 0 || infostate == 2 || infostate == 5 || infostate == 3
        "
      >
        添加
      </div>
      <div class="xyb" @click="jump('/hygdxx')">上一步</div>
      <div class="xyb" @click="jump('/hyqtzz')">下一步</div>
    </div>
  </div>
</template>
      
      <script>
import { mapState, mapMutations } from "vuex";

export default {
  data() {
    return {
      tableData: [],
      infostate: "",
    };
  },
  mounted() {
    this.infostate = this.$route.query.infostate;

    this.getinfo();
    this.getinfostate();
  },
  methods: {
    ...mapMutations(["sethymenulist"]),
    /**
     * 获取信息状态
     */
    getinfostate() {
      let that = this;
      let data = {};
      that.$http.post("mechanism/check_publicity", data).then((res) => {
        if (res.code == 1) {
          that.infostate = res.data.status;

          if (
            this.infostate == 0 ||
            this.infostate == 2 ||
            this.infostate == 5 ||
            this.infostate == 3
          ) {
          } else {
            this.sethymenulist(false);
          }
        }
      });
    },
    /**
     * 获取机构股东（合伙人）信息
     */
    getinfo() {
      let that = this;
      let data = {
        type: "user",
      };
      that.$http.post("mechanism/list", data).then((res) => {
        if (res.code === 1) {
          that.tableData = res.data.user;
        } else {
          that.tableData = [];
        }
      });
    },

    /**
     * 删除股东
     * @param {要删除的用户id} id
     */
    del(e) {
      let that = this;

      let data = {
        id: e.id,
      };
      let ts = {
        code: 1,
        msg: `您确定要将${e.realname}从您机构删除吗？`,
      };
      that.$self.ts(ts, 2).then((item) => {
        that.$http.post("mechanism/mechanism_del_user", data).then((res) => {
          that.$self.ts(res).then(() => {
            this.getinfo();
          });
        });
      });
    },
    /**
     * 页面跳转(详情)
     * @param {路径} path
     * @param {修改时传递的参数} e
     */
    next(path, e) {
      this.$router.push({
        path: path,
        query: e
          ? { id: e.id, infostate: this.infostate }
          : { infostate: this.infostate },
      });
    },
    /**
     * 页面跳转(详情)
     * @param {路径} path
     */
    jump(path) {
      this.$router.push({ path: path, query: { infostate: this.infostate } });
    },
  },
};
</script>
      <style>
.gdxx_box {
  margin-left: 0.645rem;
}
.gdxx_title {
  height: 40px;
  background: #1954a4;
  padding-left: 0.3375rem;
  display: flex;
  align-items: center;
  font-size: 0.2rem;
  font-weight: bold;
  color: #ffffff;
}
.table_gdxx {
  border: 1px solid #f2f2f2;
  border-bottom: none;
}
.table_gdxx .el-table__header thead th {
  background: #ebf2fc;
  text-align: center;
  color: #1954a4;
  height: 0.625rem;
}
.table_gdxx .el-table__body-wrapper tbody td {
  text-align: center;
}
</style>
  <style scoped>
.button_box_jb {
  display: flex;
  /* width: 4.5rem;
  justify-content: space-between; */
  margin-top: 0.2625rem;
  margin-left: 0.275rem;
  padding-bottom: 0.5rem;
}
.button_box_jb div {
  margin-right: 0.3125rem;
}
.button_box_jb .zc,
.xyb,
.hs {
  width: 1.25rem;
  height: 0.5rem;
  background: #1954a4;
  border-radius: 0.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.2rem;
  font-weight: 400;
  color: #ffffff;
  cursor: pointer;
}
.hs {
  background: #7c7c7c;
}
.hs:hover {
  background: #9c9a9a;
}
.button_box_jb .zc:hover {
  background: #1f5fb8;
}
.button_box_jb .xyb {
  background: #fca204;
}
.button_box_jb .xyb:hover {
  background: #e9a125;
}
::v-deep .el-table tr {
  font-size: 0.2rem;
}
</style>